package com.hoolai.qps.bo;

import org.jboss.netty.channel.ChannelHandlerContext;

import com.google.protobuf.Message;
import com.hoolai.synroom.logic.SynRoomPlayer;

public class Player extends SynRoomPlayer {

    private Integer channelId;
    
    private String uid = "test";//TODO
    
    //for test
    public Player(String uid) {
        super(0, null);
        this.uid = uid;
    }

    public Player(long playerId, ChannelHandlerContext channelHandlerContext) {
        super(playerId, channelHandlerContext);
    }

    public void send(Message message) {
        if(null == message || null == super.getChannelHandlerCtx()){
            return;
        }
        super.getChannelHandlerCtx().getChannel().write(new Resp(channelId, message));
    }

    public static class Resp {
        private int channelId;

        private Message message;
        
        private int cmdId;

        public int getChannelId() {
            return channelId;
        }

        public void setChannelId(int channelId) {
            this.channelId = channelId;
        }

        public Message getMessage() {
            return message;
        }

        public void setRsp(Message message) {
            this.message = message;
        }

        public Resp(int channelId, Message message) {
            super();
            this.channelId = channelId;
            this.message = message;
        }
        
        public Resp(int cmdId, int channelId){
            this.cmdId = cmdId;
            this.channelId = channelId;
        }

        public int getCmdId() {
            return cmdId;
        }

        public void setCmdId(int cmdId) {
            this.cmdId = cmdId;
        }
    }

    public Integer getChannelId() {
        return channelId;
    }

    public void setChannelId(Integer channelId) {
        this.channelId = channelId;
    }

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

}
